import type { EntityDto } from '@/models/entity';
import type { MenuButtonDto, MenuButtonResultDto, MenuButtonResultRequestDto } from '@/models/menu-button';
import type { PagedResultDto } from '@/models/paged-result';
import { httpApi } from '@/utils/axios/http';
import url from '@/utils/axios/url';

export function getMenuButtonsApi(input: MenuButtonResultRequestDto): Promise<PagedResultDto<MenuButtonResultDto>> {
    return httpApi.httpGet({ url: url.menuButton, params: input });
}

export function getMenuButtonApi(id: number): Promise<MenuButtonResultDto> {
    return httpApi.httpGet({ url: url.menuButton + '/' + id });
}

export function getMBMenusApi() {
    return httpApi.httpGet({ url: url.menuButton + '/menus' });
}

export function postMenuButtonApi(input: MenuButtonDto): Promise<MenuButtonResultDto> {
    return httpApi.httpPost({ url: url.menuButton, params: input });
}

export function postCopyButtonApi(input: Array<MenuButtonDto>): Promise<Array<MenuButtonResultDto>> {
    return httpApi.httpPost({ url: url.menuButton + '/copyButton', params: { baseMenuButtonDtos: input } });
}

export function putMenuButtonApi(input: MenuButtonDto): Promise<MenuButtonResultDto> {
    return httpApi.httpPut({ url: url.menuButton, params: input });
}

export function deleteMenuButtonApi(id: number): Promise<EntityDto> {
    return httpApi.httpDelete({ url: url.menuButton + '/' + id });
}